import java.io.IOException;
import java.util.Scanner;
//判断是否是回文字符串
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-04-25
 * Time: 22:01
 */
public class Test1 {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入字符串：");
        String str,sum="";
        int i;
        Scanner cin = new Scanner(System.in);
        str = cin.nextLine();
        //回文字符串，从左向右与从右向左，对应字符一样
        char[] ch=str.toCharArray();//将String转换为char数组
        for(i=ch.length-1;i>=0;i--){
            sum+=ch[i];//将字符串颠倒
        }
        if(sum.equals(str))
            System.out.println("是回文字符串");
        else
            System.out.println("不是回文字符串!");
    }


}
